<?php
/*
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("dinocap2", $con);
$dateTime = date("Y-m-d",strtotime("-1 day"));

*/
error_reporting(E_ALL ^ E_NOTICE);
 //FUNCTION: Connect to PostgreSql database
 
 //create a connection to postgresql database
set_time_limit(0);
ini_set("memory_limit", "200M");
  pg_connect("host=localhost dbname=comds  user=root  password=root")
   or die('Could not connect:'.pg_last_error());

  $update_query = pg_query("select id,whatday from comds");

while($update = pg_fetch_array($update_query))
{
	  $whatday = substr($update[whatday],0,10);

	 pg_query("UPDATE comds SET whatday = '$whatday' WHERE id = '$update[id]'");
}
  var_dump($whatday);die;
   
  // $del = pg_num_rows($del_query);

//mysql_query("DELETE FROM dinocap2hd WHERE whatday < '2012-03-15' or whatday >'$dateTime'");

//pg_close($con);
?>